<?php
namespace App\Api\Rules;

use Illuminate\Contracts\Validation\Rule;

use App\Api\Repositories\OptionRepositories;

class OptionVerify implements Rule{
    public function passes($attribute, $value){
        $option_repositories = new OptionRepositories();
        $data = $option_repositories->get_data($attribute);
        if(in_array($value, $data)){
            return true;
        }
        return false;
    }

    public function message(){
        return "当前选择的 :attribute 选项不存在";
    }
}